<?php

declare(strict_types=1);

namespace App\Request\Client\Task;


use App\Constants\DefaultValue;
use App\Constants\Model\TaskExec;
use Hyperf\Validation\Request\FormRequest;
use Hyperf\Validation\Rule;

class ReceiveTaskListRequest extends FormRequest
{
    public function authorize(): bool
    {
        return true;
    }

    public function rules(): array
    {
        return [
            'perPage' => [
                'integer',
                'min:0',
                'not_in:0',
                "max:" . DefaultValue::PER_PAGE_MAX
            ],
            'type' => [
                'required',
                Rule::in(
                    [
                        TaskExec::USER_TASK_LIST_STATUS_NOT_AUDIT_ON,
                        TaskExec::USER_TASK_LIST_STATUS_NOT_AUDIT_END,
                        TaskExec::USER_TASK_LIST_STATUS_AUDIT_NOT,
                        TaskExec::USER_TASK_LIST_STATUS_AUDIT_SUCCESS,
                        TaskExec::USER_TASK_LIST_STATUS_AUDIT_FAIL,
                        TaskExec::USER_TASK_LIST_STATUS_ARBITRATION_NOT,
                        TaskExec::USER_TASK_LIST_STATUS_ARBITRATION_HAS
                    ]
                ),
            ]
        ];
    }
}